OPEN DATA "C:\Users\keyem\Dropbox\PCE\PB\CA prep\Replication Data\PB_PCE_RATS.csv"
CALENDAR(M) 1978
ALL 2008:12
DATA(FORMAT=PRN,ORG=COLUMNS) 1978:01 2008:12 YEAR NMONTH COUNT PCE_I DOW HONEY NATIONAL CPI UNEMP ICS RDI $
 RAWPOS RAWNEG ECOTERM4_FREQ C8 B1 W1 D2000 INTERESTDEREG IRAQINVADE BUSHSTOCK CLINTELECT SADAM BAILOUT $
 REAGANELECT ELECT2 PCEI1DF PCEECM2DF_1 RAWPOS1DF RDI1DF NATIONAL1DF RAWNEG1DF ECOTERM4_FREQ1DF ICS1DF $
 UNEMPDF CPIDF RECESS SALT WAGE PCE_ECM2 RIP_ECM

*check to make sure data loaded correctly
table

source sbc.src
source rgser.src
source dfunit.src
source kpss.src
source vratio.src
source fif.src

*Difference variables
difference pce_i / pceid
difference national / nationald
difference cpi / cpid
difference unemp / unempd
difference ics / icsd
difference rdi / rdid
difference rawpos / rawposd
difference rawneg / rawnegd
difference dow / dowd
difference pce_ecm2 / pce_ecm2d
difference rip_ecm / ripecmd

***Figure 2: Monthly PCE
* This makes Figure 2. To make any single panel, just use those particular lines beginning with "graph"
SPGRAPH(vfields=2,hfields=1,HEADER='Figure 2: Monthly Personal Consumption Expenditures, 1978-2008')
graph(header='Monthly Personal Consumption Expenditures', VLABEL='Billions of Dollars') 1
# pce_i
graph(header='Differenced Personal Consumption Expenditures', VLABEL='Monthly Change') 1
# pceid
spgraph(done)

***Appendix B: Integration Tests and Fractional Integration
*Dickey-Fuller
@dfunit(ttest) pce_i
@dfunit(ttest) national
@dfunit(ttest) cpi
@dfunit(ttest) unemp
@dfunit(ttest) dow
@dfunit(ttest) rdi
@dfunit(ttest) rawpos
@dfunit(ttest) rawneg
@dfunit(ttest) ics

*KPSS Test
@kpss(lmax=8) pce_i
@kpss(lmax=8) national
@kpss(lmax=8) cpi
@kpss(lmax=8) unemp
@kpss(lmax=8) dow
@kpss(lmax=8) rdi
@kpss(lmax=8) rawpos
@kpss(lmax=8) rawneg
@kpss(lmax=8) ics


*Variance Ratio Test
@vratio(lags=2) pce_i
@vratio(lags=4) pce_i
@vratio(lags=8) pce_i
@vratio(lags=16) pce_i
@vratio(lags=32) pce_i

@vratio(lags=2) national
@vratio(lags=4) national
@vratio(lags=8) national
@vratio(lags=16) national
@vratio(lags=32) national

@vratio(lags=2) cpi
@vratio(lags=4) cpi
@vratio(lags=8) cpi
@vratio(lags=16) cpi
@vratio(lags=32) cpi

@vratio(lags=2) unemp
@vratio(lags=4) unemp
@vratio(lags=8) unemp
@vratio(lags=16) unemp
@vratio(lags=32) unemp

@vratio(lags=2) dow
@vratio(lags=4) dow
@vratio(lags=8) dow
@vratio(lags=16) dow
@vratio(lags=32) dow

@vratio(lags=2) rdi
@vratio(lags=4) rdi
@vratio(lags=8) rdi
@vratio(lags=16) rdi
@vratio(lags=32) rdi

@vratio(lags=2) rawpos
@vratio(lags=4) rawpos
@vratio(lags=8) rawpos
@vratio(lags=16) rawpos
@vratio(lags=32) rawpos

@vratio(lags=2) rawneg
@vratio(lags=4) rawneg
@vratio(lags=8) rawneg
@vratio(lags=16) rawneg
@vratio(lags=32) rawneg

@vratio(lags=2) ics
@vratio(lags=4) ics
@vratio(lags=8) ics
@vratio(lags=16) ics
@vratio(lags=32) ics

*Fractional Integration (Add 1 to d value)
@rgser pceid
@fif(d=0.08) pceid / pcei1df
@rgser nationald
@fif(d=-0.12) nationald / national1df
@rgser cpid
@fif(d=0.16) cpid / cpidf
@rgser unempd
@fif(d=0.24) unempd / unempdf
@rgser dowd
@rgser rdid
@fif(d=-0.19) rdid / rdi1df
@rgser rawposd
@fif(d=-0.72) rawposd / rawpos1df
@rgser rawnegd
@fif(d=-0.69) rawnegd / rawneg1df
@rgser icsd
@fif(d=-0.10) icsd / ics1df
@rgser pce_ecm2d
@fif(d=-0.39) pce_ecm2d / pceecm2df
@rgser ripecmd
@fif(d=-0.39) ripecmd / ripecmdf


*Display Fractionally Differenced Data
print / pcei1df national1df cpidf unempdf rdi1df rawpos1df rawneg1df ics1df pceecm2df  ripecmdf

***Appendix C: Cointegration Tests
***PCE & RDI***
*Cointegration Tests -- PESARAN, SHIN, AND SMITH'S ADL COINTEGRATION APPROACH
*Failing to reject HO indicates and absence of a long-run relationship
linreg pceid / rdires8
# constant pce_i{1} rdi{1} pceid{1} pceid{2} pceid{3} pceid{4} pceid{5} pceid{6} pceid{7} pceid{8} $
rdid rdid{1} rdid{2} rdid{3} rdid{4} rdid{5} rdid{6} rdid{7} rdid{8}
@sbc
exclude
# pce_i{1} rdi{1}

*Engle-Granger Representation Theorem
linreg pce_i / ecm
# constant rdi
@dfunit(ttest,lags=1) ecm
linreg pceid / ecm
# constant rdi
	*If B2 is not significant, x and y are not cointegrated

***PCE & ICS***
*Cointegration Tests -- PESARAN, SHIN, AND SMITH'S ADL COINTEGRATION APPROACH
*Failing to reject HO indicates and absence of a long-run relationship
linreg pceid / icsres8
# constant pce_i{1} ics{1} pceid{1} pceid{2} pceid{3} pceid{4} pceid{5} pceid{6} pceid{7} pceid{8} $
icsd icsd{1} icsd{2} icsd{3} icsd{4} icsd{5} icsd{6} icsd{7} icsd{8}
@sbc
exclude
# pce_i{1} ics{1}

*Engle-Granger Representation Theorem
linreg pce_i / ecm
# constant ics
@dfunit(ttest,lags=1) ecm
linreg pceid / ecm
# constant ics
	*If B2 is not significant, x and y are not cointegrated

***PCE & App***
*Cointegration Tests -- PESARAN, SHIN, AND SMITH'S ADL COINTEGRATION APPROACH
*Failing to reject HO indicates and absence of a long-run relationship
linreg pceid / appres8
# constant pce_i{1} national{1} pceid{1} pceid{2} pceid{3} pceid{4} pceid{5} pceid{6} pceid{7} pceid{8} $
nationald nationald{1} nationald{2} nationald{3} nationald{4} nationald{5} nationald{6} nationald{7} nationald{8}
@sbc
exclude
# pce_i{1} national{1}

*Engle-Granger Representation Theorem
linreg pce_i / ecm
# constant national
@dfunit(ttest,lags=1) ecm
linreg pceid / ecm
# constant nationald
	*If B2 is not significant, x and y are not cointegrated

***PCE & Unemp***
*Cointegration Tests -- PESARAN, SHIN, AND SMITH'S ADL COINTEGRATION APPROACH
*Failing to reject HO indicates and absence of a long-run relationship
linreg pceid / unempres8
# constant pce_i{1} unemp{1} pceid{1} pceid{2} pceid{3} pceid{4} pceid{5} pceid{6} pceid{7} pceid{8} $
unempd unempd{1} unempd{2} unempd{3} unempd{4} unempd{5} unempd{6} unempd{7} unempd{8}
@sbc
exclude
# pce_i{1} unemp{1}

*Engle-Granger Representation Theorem
linreg pce_i / ecm
# constant unemp
@dfunit(ttest,lags=1) ecm
linreg pceid / ecm
# constant unemp
	*If B2 is not significant, x and y are not cointegrated

***PCE & CPI***
*Cointegration Tests -- PESARAN, SHIN, AND SMITH'S ADL COINTEGRATION APPROACH
*Failing to reject HO indicates and absence of a long-run relationship
linreg pceid / cpires8
# constant pce_i{1} cpi{1} pceid{1} pceid{2} pceid{3} pceid{4} pceid{5} pceid{6} pceid{7} pceid{8} $
cpid cpid{1} cpid{2} cpid{3} cpid{4} cpid{5} cpid{6} cpid{7} cpid{8}
@sbc
exclude
# pce_i{1} cpid{1}

*Engle-Granger Representation Theorem
linreg pce_i / ecm
# constant cpi
@dfunit(ttest,lags=1) ecm
linreg pceid / ecm
# constant cpi
	*If B2 is not significant, x and y are not cointegrated

***ICS & RDI***
*Cointegration Tests -- PESARAN, SHIN, AND SMITH'S ADL COINTEGRATION APPROACH
*Failing to reject HO indicates and absence of a long-run relationship
linreg pceid / rdires8
# constant ics{1} rdi{1} icsd{1} icsd{2} icsd{3} icsd{4} icsd{5} icsd{6} icsd{7} icsd{8} $
rdid rdid{1} rdid{2} rdid{3} rdid{4} rdid{5} rdid{6} rdid{7} rdid{8}
@sbc
exclude
# ics{1} rdi{1}

*Engle-Granger Representation Theorem
linreg ics / ecm
# constant rdi
@dfunit(ttest,lags=1) ecm
linreg icsd / ecm
# constant rdi
	*If B2 is not significant, x and y are not cointegrated










